package priv.pront.code.lanqiao.team.comp.mati_2;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-11-02 22:23
 */
public class P2676_BookShelfB {

    static int n, b;
    static int[] a ;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt(); b = scanner.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        Arrays.sort(a);
        int ans =0;
        int sum = 0;
        for (int i = a.length - 1; i >= 0; i--) {
            if(sum < b){
                ans++;
                sum += a[i];
            }else{
                break;
            }
        }
        System.out.println(ans);
    }
}
